from log.logger import logger
from DecryptLogin import login
from shutil import copyfile

def weibo_login():
    try :
        client = login.Client()
        weibo = client.weibo(reload_history=True)
        copyfile('weibo.pkl',weibo.rootdir+'/weibo.pkl')
        infos_return, session = weibo.login('702068049@qq.com', '7521018hao?', 'mobile')
        global weibo_cookies
        weibo_cookies = session.cookies
        logger.info('微博登录结果:'+infos_return)
    except:
        print('微博登录失败')
        logger.info('微博登录失败')

def save_local_info_to_modules():
    from DecryptLogin import login
    client = login.Client()
    weibo = client.weibo(reload_history=True)
    copyfile('weibo.pkl',weibo.rootdir+'/weibo.pkl')
    
